package com.imc.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.imc.dao.PersonDao;
import com.imc.domain.Person;
import com.imc.persistence.CustomHibernateDaoSupport;

 

 
@Repository("personDao")
public class PersonDaoImpl extends CustomHibernateDaoSupport implements PersonDao{
 
	public void save(Person person){
		getHibernateTemplate().save(person);
	}
 
	public void update(Person person){
		getHibernateTemplate().update(person);
	}
 
	public void delete(Person person){
		getHibernateTemplate().delete(person);
	}

	@SuppressWarnings("unchecked")

	public Person findByPersonId(long personId) {
		List<Person> list =(List<Person>) getHibernateTemplate().find(
                "from Person where stockCode=?",personId
           );
	return (Person)list.get(0);
	}
 
}